Software programs enable a data processor to execute a number of functions necessary for a selected application. Often, those software programs have critical timing periods in which the data processor must wait a predetermined amount of time before executing another function. For example, such critical timing periods may occur while data is being transferred from the data processor or a clock circuit is being stabilized. During such critical timing periods, a number of programming techniques may be used to accurately provide a timing period of the correct length.
In a first programming technique, a timer circuit may be programmed to provide a data processor with an interrupt after a specified amount of time has passed. Additionally, a timer circuit allows a central processing unit of the data processor to continue processing while waiting for the interrupt to occur. In general, timers provide an efficient method for generating interrupts in time critical software applications. However, timers require a significant amount of circuit area to implement and typically are not practical in low cost data processing applications which have limited circuit area. As well, in many data processing applications, power consumption is also an important issue. Timer circuits require power to execute a timing function during operation. Additionally, timer circuits require power to transfer data and address information necessary to both program the timer and to communicate with a central processing unit and other circuits within the data processor. The transfer of information within the data processor from one section of circuitry to the next generally consumes an amount of power which may be prohibitive in data processing applications which require low power consumption.
Additionally, an amount of time required to program a timer circuit to function in a manner determined by the user may be longer than the time period required by the time critical software program. Therefore, in data processing applications which require small time periods for time critical code or which have a need for low power consumption and low cost implementations, a second programming technique may be required.
In the second programming technique, an instruction set of a data processor includes a "no operation" instruction which increments a pointer stored in a program counter register without modifying any other registers in the data processor. An example of such an instruction is provided in the instruction set of the MC68HC05, a microcomputer commercially available from Motorola, Inc. of Austin, Tex. In the MC68HC05 microcomputer, the instruction has the mnemonic form of "NOP." To use the no operation instruction, a user o of the data processor must determine an exact count of the number of timing cycles required, know the critical timing period, and be able to accurately approximate that timing period with a correct number of no operation instructions in a software program. A software program which implements no operation instructions to execute a timing period, may be applied to only the application for which it is designed and is, therefore, not very flexible.
The timing period is generally executed using a plurality of no operation instructions which are executed either successively or in a loop. In either case, memory within the data processor must be used o to store the software necessary to enable the data processor to "wait"for the critical timing period. In many low cost data processors, each byte of memory is necessary to execute a function desired by the user. Although no operation instructions may be necessary in some programming situations, the use of memory to store no operation instructions may prohibit a user from implementing another useful function.
Additionally, in applications which require data processors having low power consumption, the no operation instruction may consume a significant amount of power during execution. Accessing the instruction, transferring address and data values, and incrementing the program counter register all require a significant amount of current in the data processor. Like the timer circuit, the no operation instruction may consume a prohibitive amount of power in low power data processing applications.
For the reasons listed above, it is not generally desirable to write time critical in a software program. However, in some situations, time critical code must be used. For example, in applications which can not implement a timer circuit because of limited circuit area, a no operation instruction may be used to allow the data processor to "wait" for a predetermined period of time without the addition of a significant amount of circuitry.